$Assert=$class.create("$util.Assert");
$Assert.prototype = {
	initialize : function(){},
	
	isTrue : function(param){
		if( typeof(param)=="boolean"){
			if(param) return true;
		}else if(typeof(param)=="string"){
			v = param.toLowerCase();
			if("true"==v||"y"==v||"yes"==v||"ok"==v){
				return true;
			}else if(parseInt(v)==1){
				return true;
			}
		}else if(typeof(param)=="number"){
			return param==1;
		}
		return false;
	},

	isFalse : function(param){
		if( typeof(param)=="boolean"){
			if(!param) return true;
		}else if(typeof(param)=="string"){
			v = param.toLowerCase();
			if("false"==v||"n"==v||"no"==v||"fail"==v){
				return true;
			}else if(parseInt(v)==0){
				return true;
			}
		}else if(typeof(param)=="number"){
			return param==0;
		}
		return false;
	},
	
	isEmpty : function(param){
		if( null==param){
			return true;
		}else if(typeof(param)=="undefined"){
			return true;
		}else if(typeof(param)=="string"){
			return (/^\s*$/g).test(param);
			//return this.isMatch(param, "/^\\s*$/g");
		}
		return false;
	},
	
	isNotEmpty : function(param){
		return !this.isEmpty(param);
	},
	
	isMatch:function(str, exp){
		var endPos = exp.lastIndexOf('/');
		if( endPos>2 && exp.charAt(0)=='/' ){
			var pattern = exp.substring(1,endPos);
			var flags = exp.substr(endPos+1);
			//alert("str="+str+"\nreg="+exp+"\npattern="+pattern+"\nflags="+flags)
			var reg = new RegExp(pattern,flags);
			//var r = str.match(reg);
			//alert(typeof(r)+":"+objectToString(r));
			//alert(reg.test(str));
			return reg.test(str);
		}
		return false;
	},
	
	isNotMatch:function(str, exp){
		return !this.isMatch(str, exp);
	},
	
	none:""

}

$assert = new $Assert();
$GlobalDefine("$assert","$assert");

/*
alert("should be false:"+$assert.isTrue(null));
alert("should be false:"+$assert.isTrue(54));
alert("should be false:"+$assert.isTrue("fds"));
alert("should be true:"+$assert.isTrue("Yes"));
alert("should be true:"+$assert.isTrue(1));
alert("should be true:"+$assert.isTrue("true"));
alert("should be true:"+$assert.isTrue(true));

alert("should be false:"+$assert.isFalse(null));
alert("should be false:"+$assert.isFalse(54));
alert("should be false:"+$assert.isFalse("fds"));
alert("should be true:"+$assert.isFalse("No"));
alert("should be true:"+$assert.isFalse(0));
alert("should be true:"+$assert.isFalse(" 0 "));
alert("should be true:"+$assert.isFalse("false"));
alert("should be true:"+$assert.isFalse(false));
*/